package crack.lshape.yijian_mesh;

import java.io.IOException;

import math2.MathUtilities;
import crack.AbstractLshapeUsingSDAElementDemo;
import fem2.AbstractStructuralCrackDemo;
import fem2.Element;
import fem2.MaterialModel;
import fem2.MeshPart;
import fem2.Model;
import fem2.element.crack_sda.SOSConstantJumpCSTElement;
import fem2.material.cohesive_law.CohesiveLaw;
import fem2.material.cohesive_law.Mode1JirasekExponentialCohesiveLaw;

public class LshapeTriMeshYijianSOSConstantJumpCSTElementAndJirasekExponentialCohesiveLaw extends
		AbstractLshapeUsingSDAElementDemo {

	public LshapeTriMeshYijianSOSConstantJumpCSTElementAndJirasekExponentialCohesiveLaw() {
		meshFileName = "mesh1-sos-jirasek.msh";
	}

	@Override
	public CohesiveLaw createCohesiveLaw(Model m) {
		double ft = 2.7;
		double Gf = 0.065;
		double Dnn = 1;
		double Dmm = 1;
		return new Mode1JirasekExponentialCohesiveLaw(Gf, ft, Dnn, Dmm);
	}

	@Override
	public Element createElement(MeshPart mp, MaterialModel mm, CohesiveLaw cl) {
		Element e = new SOSConstantJumpCSTElement(mp, mm, cl);
		return e;
	}

	public static void main(String[] args) throws IOException {

		AbstractStructuralCrackDemo sample = new LshapeTriMeshYijianSOSConstantJumpCSTElementAndJirasekExponentialCohesiveLaw();

//		double[] lambda = MathUtilities.createLambdaArray(7.5, 0.1, 7.8);
		// double[] lambda = MyLinAlg.createLambdaArray(7.5, 0.1, 7.6, 0.05,
		// 10);
		// double[] lambda = MyLinAlg.createLambdaArray(7.5, 0.1, 7.6, 0.05,
		// 15);
		// double[] lambda = MyLinAlg.createLambdaArray(7.5, 0.1, 7.6, 0.05,
		// 20);
		// double[] lambda = MyLinAlg.createLambdaArray(7.5, 0.1, 7.6, 0.05,
		// 25);
		// double[] lambda = MyLinAlg.createLambdaArray(7.5, 0.1, 7.6, 0.05,
		// 30);
		// double[] lambda = MyLinAlg.createLambdaArray(7.5, 0.1, 7.6, 0.05,
		// 35);// notable
		// result
		double[] lambda = MathUtilities.createLambdaArray(7.5, 0.1, 7.6, 0.05, 40); // bad
		// result

		sample.run(lambda);

	}
}
